#!/usr/bin/env lua
-- -*- lua -*-
-- copyright: 2012 Appwill Inc.
-- author : ldmiao




--






module("mkdir", package.seeall)
local lfs = require("lfs")
local homepath = "/usr/local/moochine-demo/file/"
local ss = {}
local temp = 0
local t={}
function main(req, resp,path)
	resp.headers['Content-Type'] = 'application/json'
for i=1,string.len(path) do
	if string.sub(path,i,i) == "/" then
		table.insert(ss,string.sub(path,temp+1,i-1))
	end
end

local v1 = ss[1]
for i,v in pairs(ss) do
  v1 = v  
  lfs.mkdir(homepath .. v1)
end

local res,err = lfs.mkdir(homepath .. path) do
    if not res then
      resp:writeln(err)
      else
      resp:writeln("path:" .. path)
      resp:writeln("ctime:" .. os.date())
      resp:writeln("mtime:" .. os.date())
    end

end
end

